#include <iostream>
#include <string>
#include <map>
#include <algorithm>

struct c_chless
{
	bool operator() (const char& x, const char& y) const 
	{
		if((x >= 'a') && (x <= 'z') && (y >= 'A') && (y <= 'Z'))
			return true;
		if((y >= 'a') && (y <= 'z') && (x >= 'A') && (x <= 'Z'))
			return false;
		return x < y;
	}
};

using namespace std;

int main() {
	
	int N, i, j;
	string str;
	map<char, int, c_chless> freq;
	map<char, int>::iterator freq_it;
	
	getline(cin, str);
	
	while(getline(cin, str))
	{
		for(j = 0; j < str.length(); j++)
		{
			if(str[j] != ' ')
			{
				if(freq.find(str[j]) == freq.end())
				{
					freq.insert(make_pair<char,int>(str[j], 1));
				}
				else
				{
					freq[str[j]]++;
				}
			}
		}
	}
	
	for(freq_it = freq.begin(); freq_it != freq.end(); freq_it++)
	{
		cout <<  freq_it->first << " " << freq_it->second << endl;
	}
	
	return 0;
}
